#include "DocumentHandlerImpl.h"
#include "SelectorList.h"
#include "LexicalUnit.h"
#include "Selector.h"
#include <stdio.h>

void DocumentHandlerImpl::StartDocument()throw(CSSException)
{

}

void DocumentHandlerImpl::EndDocument()throw(CSSException)
{

}

void DocumentHandlerImpl::comment(const string& text)throw(CSSException)
{

}

void DocumentHandlerImpl::ignorableAtRule(const string& atRule)throw(CSSException)
{

}

void DocumentHandlerImpl::namespaceDeclaration(const string& prefix,
											   const string& uri)throw(CSSException)
{

}

void DocumentHandlerImpl::importStyle(const string& uri, const SACMediaList* media,
									  const string& defaultNamespaceURI)throw(CSSException)
{

}

void DocumentHandlerImpl::startMedia(const SACMediaList* media)throw(CSSException)
{

}

void DocumentHandlerImpl::endMedia(const SACMediaList* media)throw(CSSException)
{

}

void DocumentHandlerImpl::startPage(const string& name,
									const string& pseudo_page)throw(CSSException)
{

}

void DocumentHandlerImpl::endPage(const string& name,
								  const string& pseudo_page)throw(CSSException)
{

}

void DocumentHandlerImpl::startFontFace()throw(CSSException)
{

}

void DocumentHandlerImpl::endFontFace()throw(CSSException)
{

}

void DocumentHandlerImpl::startSelector(const SelectorList* selectors)throw(CSSException)
{
	int length = selectors->getLength();
	printf("startSelector: Selector's num(%d)\n", length);
	for(int i = 0; i < length; ++i)
	{
		printf("(%d)%s\n", i, selectors->item(i).toString()->c_str());
	}
}

void DocumentHandlerImpl::endSelector(const SelectorList* selectors)throw(CSSException)
{
	printf("endSelector\n");
}

void DocumentHandlerImpl::property(const string& name, const LexicalUnit* value,
								   bool important)throw(CSSException)
{
	printf("property:\n");
	printf("\tname = %s\n", name.c_str());
	const LexicalUnit* p = value;
	printf("\tvalue = ");
	while(p)
	{
		printf("%s ", p->toString()->c_str());
		p = p->getNextLexicalUnit();
	}
	printf("\n");
	printf("important = %s\n", (important?"true":"false"));
}
